package com.detect.common.utils;

import lombok.SneakyThrows;
import okhttp3.*;


/**
 * 请求工具类
 *
 * @author zhulj
 * @since 2024/6/13 15:47
 **/
public class HttpUtil {

    static final OkHttpClient HTTP_CLIENT = new OkHttpClient().newBuilder().build();

    @SneakyThrows
    public static Response post(String url, RequestBody body) {
        Request request = new Request.Builder()
                .url(url)
                .method("POST", body)
                .addHeader("Content-Type", "application/x-www-form-urlencoded")
                .build();
        return HTTP_CLIENT.newCall(request).execute();
    }
}
